import { defineStore } from "pinia";

export const useDishList = defineStore({
  id: "dishList",
  state: () => ({
    list: [],
  }),

  actions: {
    addItem(item) {
      console.log(item);
      if (Array.isArray(item)) {
        this.list.push(...item);
      } else {
        this.list.push(item);
      }
    },

    removeItem(index) {
      this.list.splice(index, 1);
    },

    clearItem() {
      this.list = [];
    },
  },
});
